package com.nwcl.ysx.service.impl;

import com.nwcl.common.utils.BeanUtil;
import com.nwcl.ysx.bo.RestaurantDishesBO;
import com.nwcl.ysx.dao.RestaurantDishesDao;
import com.nwcl.ysx.entity.RestaurantDishes;
import com.nwcl.ysx.service.RestaurantDishesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author liguiqin
 * @date 2023/5/25
 */
@Service
public class RestaurantDishesServiceImpl implements RestaurantDishesService {
    @Autowired
    private RestaurantDishesDao restaurantDishesDao;
    @Override
    public List<RestaurantDishesBO> listByRestaurantId(Integer restaurantId) {
        List<RestaurantDishes> list =restaurantDishesDao.listByRestaurantId(restaurantId);
        if(CollectionUtils.isEmpty(list)){
            return Collections.emptyList();
        }
        return BeanUtil.copyList(list,RestaurantDishesBO.class);
    }
}
